package cn.dglydrpy.eshop.website.learn;

import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.stereotype.Component;

/**
 * 自定义监控健康指示器
 */
@Component
public class MyHealthIndicator extends AbstractHealthIndicator {

    public static boolean STATUS = true ;

    @Override
    protected void doHealthCheck(Health.Builder builder) throws Exception {
        if(!STATUS){
            throw new RuntimeException();  //抽象接口将把状态置为down并把异常信息写入down的details.error
        }
        builder.up();
    }
}
